package com.test.ml.yqs.service;


import com.test.ml.yqs.utills.HttpClientUtil;
import org.apache.http.cookie.Cookie;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class LoginService {
	@Value("${cqssc.login.url}")
	private String  LOGIN_URL;

	/**
	 * 重庆时时彩登陆
	 * @param loginName
	 * @param loginPwd
	 * @return
	 */
	public boolean login(String loginName,String loginPwd){
		Map<String, String> map=new HashMap<String, String>();
		map.put("loginName", loginName);
		map.put("loginPwd", loginPwd);
		map.put("ValidateCode", "验证码");
		map.put("Submit", "登陆");
		List<Cookie> cookies = HttpClientUtil.doPost(map, LOGIN_URL).getCookies();
		
		if(cookies==null|| cookies.isEmpty()){
			System.out.println("登陆失败,账号或密码错误！");
			return false;
		}else{
			System.out.println("登陆成功");
			return true;
		}
	}
	
}
